home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / TURB_VIS / TVSPY / HEAPWIN.PAS < prev    next >
Pascal/Delphi Source File  |  1990-12-17  |  1KB  |  66 lines

  1. Unit HeapWin;
  2.  
  3. {************************************************************************}
  4. { A small window to display the amount of free memory.  Call the Update  }
  5. { method from your application's Idle method.                            }
  6. { Copyright (c) 1990 by Danny Thorpe                                     }
  7. {************************************************************************}
  8.  
  9. interface
  10.  
  11. uses Dos, Objects, Views, App;
  12.  
  13. type
  14.  
  15.     PHeapWin = ^THeapWin;
  16.     THeapWin = object (TWindow)
  17.              OldMem : LongInt;
  18.              constructor Init;
  19.              procedure Draw; virtual;
  20.              procedure UpDate;
  21.              procedure SizeLimits (var Min, Max : TPoint); virtual;
  22.     end;
  23.  
  24.  
  25. const HeapWindow: PHeapWin = nil;
  26.  
  27. implementation
  28.  
  29. constructor THeapWin.Init;
  30. var R : TRect;
  31. begin
  32.   Desktop^.GetExtent(R);
  33.   R.Assign ( R.B.X-14,R.A.Y,R.B.X,R.A.Y+3);
  34.   TWindow.Init (R, 'Heap', 0);
  35.   Flags := wfMove;
  36.   Options:= Options or ofFirstClick;
  37. end;
  38.  
  39.  
  40.  
  41. procedure THeapWin.Draw;
  42. var S : String;
  43. begin
  44.   TWindow.Draw;
  45.   OldMem := MemAvail;
  46.   Str (OldMem, S);
  47.   WriteStr (4,1,S,1);
  48. end;
  49.  
  50.  
  51. procedure THeapWin.UpDate;
  52. begin
  53.   if (OldMem<>MemAvail) then DrawView;
  54. end;
  55.  
  56.  
  57. procedure THeapWin.SizeLimits (var Min, Max : TPoint);
  58. begin
  59.   Max.X := 14;
  60.   Max.Y := 3;
  61.   Min.X := 14;
  62.   Min.Y := 3;
  63. end;
  64.  
  65.  
  66. end.